/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.ipti.br.tag.entity.enums;

import java.util.Calendar;
import java.util.EnumSet;

/**
 *
 * @author luancorumba
 */
public enum WeekDay { //ESTA ORDEM NUNCA DEVE SER ALTERADA
    SUNDAY("Domingo"),
    MONDAY("Segunda"),
    TUESDAY("Terça"),
    WEDNESDAY("Quarta"),
    THURSDAY("Quinta"),
    FRIDAY("Sexta"),
    SATURDAY("Sábado");

    private String day;
    private static final EnumSet<WeekDay> WORKDAY = EnumSet.range(MONDAY, FRIDAY);

    private WeekDay(String dia) {
        this.day = dia;
    }
 
    public final boolean isWorkday() {
        return WORKDAY.contains(this);
    }
    
    public static WeekDay getDay(int i){
        return values()[i - 1];
    }
    
    public static WeekDay getDay(Calendar c){
        return values()[c.get(Calendar.DAY_OF_WEEK) - 1];
    }
    
    public int getCalendarDay(){
        return this.ordinal() +1;
    }

    @Override
    public String toString() {
        return day;
    }
}